<?php

namespace Framework\Middleware;

use Framework\Session;

class Authorise{
    public function isAuthenticated(){
        return Session::has('user');
        // return true;
    }

    public function handle($role){
        if ($role === 'guest' && $this->isAuthenticated()) {
            # code...
            return redirect('/');
        } elseif ($role === 'auth' && !$this->isAuthenticated()) {
            # code...
            return redirect('/auth/login');
        }
    }
}

?>